package com.string;

import java.lang.reflect.Array;

public class TestStringNULL {
	public static String toSimpleString(Object array, String separator) {
		StringBuilder sb = new StringBuilder();
		if (array != null) {
			if (!array.getClass().isArray()) {
				sb.append(array);
			} else {
				for (int i = 0; i < Array.getLength(array); i++) {
					if (sb.length() == 0) {
						sb.append(Array.get(array, i));
					} else {
						sb.append(separator).append(Array.get(array, i));
					}
				}
			}
		}
		return sb.toString();
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String[] str = {null};
		String xx  = toSimpleString(str,",");
		System.out.println(xx);
		
		String s = "" ;
		System.out.println(s);

	}

}
